package com.situ.vivamarket.service.front.impl;

import com.situ.vivamarket.dao.CouponDao;
import com.situ.vivamarket.model.front.Coupon;
import com.situ.vivamarket.service.front.CouponService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CouponServiceImpl implements CouponService {
    private CouponDao couponDao;
    @Autowired
    public void setCouponDao(CouponDao couponDao) {
        this.couponDao = couponDao;
    }

    @Override
    public boolean add(Coupon coupon) {
        return couponDao.insert(coupon)>0;
    }

    @Override
    public int delete(String code) {
        return couponDao.delete(code);
    }

    @Override
    public Coupon findByMemberId(Integer memberId) {
        return couponDao.findByMemberId(memberId);
    }
}

